//
//  UILabel+Property.m
//  RiceBasket
//
//  Created by DwZeng on 2021/1/15.
//

#import "UILabel+Property.h"


@implementation UILabel (Property)

+(UILabel* (^)())init{
    return ^(){
        UILabel *view = [[self alloc] init];
        return view;
    };
}

+(UILabel *(^)(CGRect frame))initFrame{
    return ^(CGRect frame){
        UILabel *view = [[self alloc] initWithFrame:frame];
        return view;
    };
}

-(UILabel *(^)(NSString *))textStr{
    return ^(NSString *text){
        self.text = text;
        return self;
    };
}

-(UILabel *(^)(CGFloat))textFont{
    return ^(CGFloat font){
        self.font = [UIFont fontOfSize:font];
        return self;
    };
}

-(UILabel *(^)(NSString *color))color{
    return ^(NSString *color){
        self.textColor = [UIColor colorWithHexString:color];
        return self;
    };
}

-(UILabel *(^)(NSTextAlignment alignment))alignment{
    return ^(NSTextAlignment alignment){
        self.textAlignment = alignment;
        return self;
    };
}

-(UILabel *(^)(NSInteger lines))lines{
    return ^(NSInteger lines){
        self.numberOfLines = lines;
        return self;
    };
}

-(UILabel *(^)())size{
    return ^(){
        [self sizeToFit];
        return self;
    };
}

-(UILabel *(^)(NSString*))bgColor{
    return ^(NSString *color){
        self.backgroundColor = [UIColor colorWithHexString:color];
        return self;
    };
}

@end
